import Vue from "vue";
import App from "./App.vue";
import store from "./store";
import router from "./router";
import DataV from "@jiaminghi/data-view";
import ElementUI from "element-ui";
import Echart from "./components/echart/index.vue";
import ItemWrap from "./components/item-wrap/item-wrap.vue";
import Message from "./components/message/message.vue";
import Reacquire from "./components/reacquire/reacquire.vue";
import Messages from "./components/message/message";
import "vue-easytable/libs/theme-default/index.css";
import "@/assets/css/public.scss";
import "@/assets/css/index.scss";
import "./views/layout/layout.scss";
import { download } from "./api/api.js";
import * as filters from "./filters/filters.js";
//引入echarts
import * as echarts from "echarts";

// 自定义组件
Vue.component("Echart", Echart);
Vue.component("ItemWrap", ItemWrap);
Vue.component("Message", Message);
Vue.component("Reacquire", Reacquire);
Vue.prototype.$Message = Messages;
Vue.prototype.download = download;
// element组件

function px2rem(px) {
	if (/%/gi.test(px)) {
		return px;
	} else {
		return parseFloat(px) / 37.5 + "rem";
	}
}
Vue.prototype.$px2rem = px2rem; // 放到全局

//vue全局注入echarts
Vue.prototype.$echarts = echarts;

// 使用element UI
Vue.use(ElementUI);

// datav组件
Vue.use(DataV);

//全局过滤器
Object.keys(filters).forEach((key) => {
	Vue.filter(key, filters[key]);
});

// 全局数据过滤器
new Vue({
	router,
	store,
	render: (h) => h(App),
}).$mount("#app");
